Seccomp
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
top
seccomp (short for secure computingcite-ref-1[1]) is a computer security facility in the Linux kernel. seccomp allows a process to make a one-way transition into a "secure" state where it cannot make any system calls except exit(), sigreturn(), read() and write() to already-open file descriptors. Should it attempt any other system calls, the kernel will either just log the event or terminate the process with SIGKILL or SIGSYS.cite-ref-2[2]cite-ref-3[3] In this sense, it does not virtualize the system's resources but isolates the process from them entirely.
seccomp mode is enabled via the prctl(2) system call using the PR_SET_SECCOMP argument, or (since Linux kernel 3.17cite-ref-4[4]) via the seccomp(2) system call.cite-ref-5[5] seccomp mode used to be enabled by writing to a file, /proc/self/seccomp, but this method was removed in favor of prctl().cite-ref-6[6] In some kernel versions, seccomp disables the RDTSC x86 instruction, which returns the number of elapsed processor cycles since power-on, used for high-precision timing.cite-ref-7[7]
seccomp-bpf is an extension to seccompcite-ref-8[8] that allows filtering of system calls using a configurable policy implemented using Berkeley Packet Filter rules. It is used by OpenSSHcite-ref-openssh-6-0-9-0[9] and vsftpd as well as the Google Chrome/Chromium web browsers on ChromeOS and Linux.cite-ref-10[10] (In this regard seccomp-bpf achieves similar functionality, but with more flexibility and higher performance, to the older systrace—which seems to be no longer supported for Linux.)
Contents
• History
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
History
seccomp was first devised by Andrea Arcangeli in January 2005 for use in public grid computing and was originally intended as a means of safely running untrusted compute-bound programs. It was merged into the Linux kernel mainline in kernel version 2.6.12, which was released on March 8, 2005.cite-ref-11[11]
Software using seccomp or seccomp-bpf
• Docker – software that allows applications to run inside of isolated containers. Docker can associate a seccomp profile with the container using the --security-opt parameter.
• Arcangeli's CPUShare was the only known user of seccomp for a while.cite-ref-lkml-2009-02-28-141-15-0[15] Writing in February 2009, Linus Torvalds expresses doubt whether seccomp is actually used by anyone.cite-ref-lkml-2009-02-28-129-16-0[16] However, a Google engineer replied that Google is exploring using seccomp for sandboxing its Chrome web browser.cite-ref-17[17]cite-ref-lkml-2009-05-06-365-18-0[18]
• Firejail is an open source Linux sandbox program that utilizes Linux namespaces, Seccomp, and other kernel-level security features to sandbox Linux and Wine applications.cite-ref-19[19]
• As of Chrome version 20, seccomp-bpf is used to sandbox Adobe Flash Player.cite-ref-20[20]
• As of Chrome version 23, seccomp-bpf is used to sandbox the renderers.cite-ref-21[21]
• SydBox uses seccomp-bpfcite-ref-38[38] to improve the runtime and security of the ptrace sandboxing used to sandbox package builds on Exherbo Linux distribution.
• File, a Unix program to determine filetypes, uses seccomp to restrict its runtime environmentcite-ref-39[39]
References
cite-note-33. ↑ "Documentation/prctl/seccomp_filter.txt". Retrieved 2017-10-05.
cite-note-44. ↑ "Linux kernel 3.17, Section 11. Security". kernelnewbies.org. 2013-10-05. Retrieved 2015-03-31.
cite-note-55. ↑ "seccomp: add "seccomp" syscall". kernel/git/torvalds/linux.git - Linux kernel source tree. kernel.org. 2014-06-25. Retrieved 2014-08-22.
cite-note-66. ↑ citerefarcangeli2007Arcangeli, Andrea (2007-06-14). "[PATCH 1 of 2] move seccomp from /proc to a prctl". Retrieved 2013-08-02.
cite-note-77. ↑ citereftinnes2009Tinnes, Julien (2009-05-28). "Time-stamp counter disabling oddities in the Linux kernel". cr0 blog. Retrieved 2013-08-02.
cite-note-openssh-6-0-99. ↑ "Openssh 6.0 release notes". Retrieved 2013-10-14.
cite-note-1111. ↑ "[PATCH] seccomp: secure computing support". Linux kernel history. Kernel.org git repositories. 2005-03-08. Archived from the original on 2013-04-15. Retrieved 2013-08-02.
cite-note-1212. ↑ "Seccomp filter in Android O". Android Developers Blog.
cite-note-1313. ↑ "systemd.exec — Execution environment configuration". freedesktop.org. Retrieved 2017-10-14.
cite-note-1414. ↑ citerefotubo2017Otubo, Eduardo (2017-09-15). "QEMU Sandboxing new model pull request". qemu-devel mailing list archive.
cite-note-lkml-2009-02-28-141-1515. ↑ citerefvan-de-ven2009van de Ven, Arjan (2009-02-28). "Re: [stable] [PATCH 2/2] x86-64: seccomp: fix 32/64 syscall hole". Linux Kernel Mailing List. Retrieved 2013-08-02.
cite-note-lkml-2009-02-28-129-1616. ↑ citereftorvalds2009Torvalds, Linus (2009-02-28). "Re: [PATCH 2/2] x86-64: seccomp: fix 32/64 syscall hole". Linux Kernel Mailing List. Retrieved 2013-08-02.
cite-note-1717. ↑ citerefgutschke2009Gutschke, Markus (2009-05-06). "Re: [PATCH 2/2] x86-64: seccomp: fix 32/64 syscall hole". Retrieved 2013-08-02.
cite-note-lkml-2009-05-06-365-1818. ↑ citerefgutschke2009Gutschke, Markus (2009-05-06). "Re: [PATCH 2/2] x86-64: seccomp: fix 32/64 syscall hole". Linux Kernel Mailing List. Retrieved 2013-08-02.
cite-note-1919. ↑ "Firejail". Firejail. Retrieved 2016-11-26.
cite-note-2020. ↑ citerefevans2012Evans, Chris (2012-07-04). "Chrome 20 on Linux and Flash sandboxing". Retrieved 2013-08-02.
cite-note-2121. ↑ citereftinnes2012Tinnes, Julien (2012-09-06). "Introducing Chrome's next-generation Linux sandbox". cr0 blog. Retrieved 2013-08-02.
cite-note-2222. ↑ "Snap security policy". Archived from the original on 2017-02-04. Retrieved 2017-02-03.
cite-note-2323. ↑ citerefevans2012Evans, Chris (2012-04-09). "vsftpd-3.0.0 and seccomp filter sandboxing is here!". Retrieved 2013-08-02.
cite-note-2424. ↑ "MBOX". Retrieved 2014-05-20.
cite-note-2525. ↑ "LXD an "hypervisor" for containers (based on liblxc)". 4 November 2014. Retrieved 2014-11-08.
cite-note-2626. ↑ "Where We're Going With LXD". Retrieved 2014-11-08.
cite-note-2727. ↑ citerefdestuynder2012Destuynder, Guillaume (2012-09-13). "Firefox Seccomp sandbox". Mozilla Bugzilla. Retrieved 2015-01-13.
cite-note-2828. ↑ citerefdestuynder2012Destuynder, Guillaume (2012-09-13). "Firefox Seccomp sandbox". Mozilla Wiki. Retrieved 2015-01-13.
cite-note-2929. ↑ "Tor ChangeLog".
cite-note-3030. ↑ "Lepton image compression: saving 22% losslessly from images at 15MB/s". Dropbox Tech Blog. Retrieved 2016-07-15.
cite-note-3131. ↑ "Kafel: A language and library for specifying syscall filtering policies".
cite-note-3232. ↑ "Subgraph OS". Subgraph. Retrieved 2016-12-18.
cite-note-3333. ↑ "LoganCIJ16: Future of OS". YouTube. Archived from the original on 2021-12-21. Retrieved 2016-12-18.
cite-note-3434. ↑ "The flatpak security model – part 1: The basics". Retrieved 2017-01-21.
cite-note-3535. ↑ "bubblewrap". Retrieved 2018-04-14.
cite-note-3636. ↑ "Chromium OS Sandboxing - the Chromium Projects".
cite-note-3737. ↑ "Minijail [LWN.net]". lwn.net. Retrieved 2017-04-11.
cite-note-3838. ↑ "core/trace/use_seccomp". dev.exherbo.org. Retrieved 2021-05-31.
cite-note-4040. ↑ "Zathura seccomp implementation".
cite-note-4141. ↑ "Gnome tracker seccomp implementation".
External links
• Official website (Archived)
• Google's Chromium sandbox, LWN.net, August 2009, by Jake Edge
• seccomp-nurse, a sandboxing framework based on seccomp
• Documentation/prctl/seccomp_filter.txt, part of the Linux kernel documentation
• Security In-Depth for Linux Software: Preventing and Mitigating Security Bugs